package com.naiterui.ehp.bs.esign.api.bjca.vo;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Builder;
import lombok.Data;

/**
 * @author guoyongxiang
 * @date 2019/11/22 16:04
 * @since 1.0.0
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@Builder
@Data
public class YwxResponseVO<T> implements Serializable {

    private static final long serialVersionUID = 6319043851963055671L;

    public static final String CODE_SUCCESS = "0";
    public static final String CODE_ERROR = "1";
    /**
     * accessToken 已过期，请重新获取
     */
    public static final String CODE_ACCESS_TOKEN_EXPIRE = "005x016";
    /**
     * 有效期内，再次获取了新token，但未使用新获取的token
     */
    public static final String CODE_ACCESS_TOKEN_INVALID = "005x019";

    /**
     * 状态码(0正常)
     */
    private String status;
    /**
     * 状态说明
     */
    private String message;
    /**
     * 响应数据
     */
    private T data;

    public boolean isSuccess(){
        if(CODE_SUCCESS.equals(status)){
            return true;
        }
        return false;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
